package cn.qihua.service;

import java.util.List;
import java.util.Set;

import cn.qihua.dao.ISysOrganizationDAO;
import cn.qihua.dao.ISysResourceDAO;
import cn.qihua.dao.ISysRoleDAO;
import cn.qihua.dao.ISysUserDAO;
import cn.qihua.model.SysOrganization;
import cn.qihua.model.SysResource;
import cn.qihua.model.SysRole;

public interface ISystemService {

	public abstract SysOrganization findOrgById(Integer id);

	public abstract SysResource findResById(Integer id);

	public abstract SysRole findRoleById(Integer id);

	public abstract List<SysOrganization> findByParentId(Integer parentId);

	public abstract void addOrg(SysOrganization transientInstance);

	public abstract void addRes(SysResource transientInstance);

	public abstract void addRole(SysRole transientInstance);

	public abstract boolean delOrg(Integer id);

	public abstract boolean delRes(Integer id);

	public abstract boolean delRole(Integer id);

	public abstract List<SysOrganization> findAllOrg();

	public abstract List<SysResource> findAllRes();

	public abstract List<SysRole> findAllRole();

	// 根据角色编号得到角色标识符列表
	public abstract Set<String> findRoles(List<Integer> list);

	// 根据角色编号得到权限字符串列表
	public abstract Set<String> findPermissionsByRole(List<Integer> list);

	// 得到资源对应的权限字符串
	public abstract Set<String> findPermissionsByRes(Set<Integer> resourceIds);

	// 根据用户权限得到菜单
	public abstract List<SysResource> findMenus(Set<String> permissions);

	/**
	 * 根据用户ID查找其角色
	 * @param username
	 * @return
	 */
	public abstract Set<String> findRolesByUName(String username);

	/**
	 * 根据用户ID查找其权限
	 * @param username
	 * @return
	 */
	public abstract Set<String> findPermissionsByUName(String username);

	public abstract void setSysOrganizationDAO(
			ISysOrganizationDAO sysOrganizationDAO);

	public abstract void setSysResourceDAO(ISysResourceDAO sysResourceDAO);

	public abstract void setSysRoleDAO(ISysRoleDAO sysRoleDAO);

	public abstract void setSysUserDAO(ISysUserDAO sysUserDAO);

}